<template>
	<view class="count">
		<view class="top">
			<u-tabs :list="list" active-color="#009D85" :is-scroll="false" :current="current" @change="change"></u-tabs>
		</view>
		<!-- 主题内容 -->
		<view class="body p-25">
			<view v-for="(item,index) in 1" :key="index" class="item p-25 b-r-15 m-b-20">
				<view class="topName f f-a-c f-j-b">
					<view class="unpload">
						{{objList[current].subject||'--'}}
					</view>
					<view v-if="!objList[current].comment" class="filled" :class="{act:true}">
						评语未填写
					</view>
				</view>
				<view class="tiNei m-t-20">
					提交内容
				</view>
				<!-- <view class="bodyBg"> -->
				<view class="bodyBg m-b-30">
					{{objList[current].content||'---'}}
				</view>
				<view class="tiNei m-t-20">
					图片
				</view>
				<view v-if="objList[current].image" class="bodyBg m-b-30 f f-a-c f-w-w">
					<div style="width: 170rpx;height: 170rpx;"
						v-for="(ite,inde) in String(objList[current].image).split(',')" :key="inde">
						<!-- {{ite}} -->
						<image :src="ite" mode="aspectFit" @click="handleImageClick(ite,inde)"
							style="width: 100%;height: 100%;"></image>
					</div>

				</view>
				<view class="tiNei m-t-20">
					视频
				</view>
				<view v-if="objList[current].video" class="bodyBg m-b-30">
					<video class="coolViold" :enable-danmu="false" :show-fullscreen-btn="false"
						:show-center-play-btn="true" :danmu-btn="false" :controls="true"
						:src="objList[current].video"></video>
				</view>
				<!-- 	<view class="tiNei m-t-20">
					录音
				</view>
				<view class="bodyBg m-b-30">
					<image src="/static/audio.png" @click="playAudio" class="audioImg" mode=""></image>
				</view> -->
				<!-- </view> -->
				<view v-if="objList[current].comment" class="btn">
					<view @click="shows=true" class="remark">
						查看评语
					</view>
				</view>
			</view>
		</view>
		<u-mask :show="shows" @click="show = false">
			<view class="tan p-20 p-t-40">
				<image src="/static/cha.png" @click="shows=false" class="cha" mode=""></image>
				<view class="points m-b-40">
					评语
				</view>
				<view class="bodyB">
					{{objList[current].comment}}
					<!-- 456456666666666666666666666666666666666666666666666666666666666 -->
				</view>
				<view @click="shows=false" class="btns">
					确认
				</view>
			</view>
		</u-mask>
		<!-- <button @click="baidu">跳转百度</button> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shows: false,
				current: 0,
				list: [{
					name: '第1关'
				}, {
					name: '第2关'
				}, {
					name: '第3关'
				}, {
					name: '第4关'
				}, {
					name: '第5关'
				}, {
					name: '第6关'
				}],
				objList: [],
				audioContext: null,
			}
		},
		onLoad(options) {
			this.objList = JSON.parse(options.obj)
		},
		onUnload() {
			this.audioContext.stop()
		},
		onHide() {
			console.log('12121212121211212121212');
			this.audioContext.stop()
		},
		methods: {
			handleImageClick(ite, ind) {
				wx.previewImage({
					urls: String(this.objList[this.current].image).split(','), //需要预览的图片http链接列表，多张的时候，url直接写在后面就行了
					current: ite, // 当前显示图片的http链接，默认是第一个
					success: function(res) {},
					fail: function(res) {},
					complete: function(res) {},
				})
			},
			// 点击播放MP3
			playAudio() {
				if (this.objList[this.current].audio) {
					if (this.audioContext) {
						this.audioContext.stop()
					}
					this.audioContext = uni.createInnerAudioContext();
					// 设置音频源
					this.audioContext.src = this.objList[this.current].audio;
					this.audioContext.play();
				} else {
					this.$msg('暂无音频')
				}
			},
			// 跳转到百度
			// baidu() {
			// 	uni.navigateTo({
			// 		url: '/pageLogin/webView'
			// 	})
			// },
			change(index) {
				this.current = index;
			}
		}
	}
</script>
<style>
	page {
		background-color: #f6f6f6;
	}
</style>
<style lang="scss" scoped>
	.audioImg {
		width: 100rpx;
		height: 100rpx;
	}

	.tan {
		position: relative;
		width: 70%;
		height: 418rpx;
		background: #ffffff;
		border-radius: 16rpx;
		margin-top: 60%;
		margin-left: 50%;
		transform: translate(-50%, -0%);
		box-sizing: border-box;

		.btns {
			position: absolute;
			width: 90%;
			height: 80rpx;
			line-height: 80rpx;
			background: #009d85;
			border-radius: 40rpx;
			font-size: 26rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			text-align: center;
			color: #ffffff;
			bottom: 30rpx;
			left: 50%;
			transform: translateX(-50%);
		}

		.points {
			font-size: 32rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			text-align: center;
			color: #000000;
		}

		.bodyB {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;
			text-align: center;
			color: #333333;
			overflow-wrap: break-word;
		}

		.cha {
			width: 42rpx;
			height: 42rpx;
			position: absolute;
			top: -60rpx;
			right: 5rpx;
		}
	}

	.btn {
		margin-top: 20rpx;
		display: flex;
		align-items: center;
		justify-content: flex-end;

		.remark {
			width: 168rpx;
			height: 64rpx;
			line-height: 64rpx;
			background: #009d85;
			border-radius: 32rpx;
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;
			text-align: center;
			color: #ffffff;
		}
	}

	.bodyBg {
		margin-top: 20rpx;
		width: 100%;
		border-radius: 15rpx;
		padding: 20rpx;
		background-color: #f9f9f9;
		word-wrap: break-word;
		line-height: 2;

		.coolViold {
			width: 100%;
			height: 200px;
		}
	}

	.topName {
		.tiNei {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;
			text-align: left;
			color: #666666;
			margin: 15rpx 0;
		}

		.unpload {
			font-size: 30rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			color: #999999;
			width: 75%;
		}

		.filled {
			font-size: 26rpx;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;
			color: #333;
		}

		.act {

			color: #009D85;
		}
	}

	.item {
		width: 100%;
		background-color: #fff;
	}

	.top {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;

	}

	.count {
		height: 100vh;
		width: 100%;
		padding-top: 80rpx;
	}
</style>